package com.tianqu.tms.www.proxymember.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.entity.Codes;
import com.tianqu.tms.www.proxymember.actionform.ProxymemberCreationInputActionForm;
import com.tianqu.tms.www.proxymember.viewhelper.ProxyMemberCarSearchInputViewHelper;

/**
 * @author zhangxueliang
 *待办车辆（已缴费）信息确认action
 */
public class ProxyMemberCarPaidConfirmAction extends TmsAction{
	private Logger logger = Logger.getLogger(ProxyMemberCarPaidConfirmAction.class);
	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		logger.debug(this.getClass().getName() + "#execute was called.");
		ProxyMemberCarSearchInputViewHelper viewhelp = new ProxyMemberCarSearchInputViewHelper();
		viewhelp = (ProxyMemberCarSearchInputViewHelper)uc.getAttribute(TmsConstants.VIEWHELP);
		ProxymemberCreationInputActionForm proxyForm = (ProxymemberCreationInputActionForm)form;
		Codes code = Codes.getInstance();
		
		viewhelp.setTransferType(code.getItemValueByItemIdAndItemCode(Codes.TRANSFER_TYPE, proxyForm.getTransferType()));
		viewhelp.setNewOwnerType(code.getItemValueByItemIdAndItemCode(Codes.CAR_OWNER, proxyForm.getNewOwnerType()));
		viewhelp.setGainType(code.getItemValueByItemIdAndItemCode(Codes.GAIN_TYPE, proxyForm.getGainType()));
		uc.setAttribute(TmsConstants.VIEWHELP, viewhelp);
		request.setAttribute(VIEWHELP, viewhelp);
		
		logger.debug(this.getClass().getName() + "#execute was completed.");
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
